﻿
@{

}
<div class="bjui-pageContent">
    <table class="table table-bordered" id="datagrid-User@(Request.QueryString["_"])" data-toggle="datagrid"></table>
</div>
<script type="text/javascript">
    var userGrid@(Request.QueryString["_"]) = $('#datagrid-User@(Request.QueryString["_"])');
    userGrid@(Request.QueryString["_"]).datagrid({
        height: '100%',
        width: '100%',
        showToolbar: true,
        toolbarItem: 'refresh,add,edit,save,exportf,del',
        dataUrl: '/User/UserSearch',
        dataType: 'json',
        //editMode: { dialog: { width: 800, height: 250, mask: true, faicon: 'caret-right', icon: 'plus', title: "编辑", fresh: true } },
        editMode: "inline",
        editUrl: '/User/UserUpsert',
        afterSave: saveCallBack,
        delUrl: '/User/DelUser',
        delPK: 'id',
        paging: { pageSize: 20, orders: 'ADDED asc' },
        inlineEditMult: false,
        filterThead: true,
        linenumberAll: true,
        fieldSortable: true,
        columnFilter: true,
        showCheckboxcol: false,
        toolbarCustom: customtBtn,
        exportOption: { type: "file", options: { url: "/User/UserExport", outPutFileName: '@Html.CurLang("用户")' } },
        columns: [
            { name: 'id', align: 'center', width: 500, label: '@Html.CurLang("ID")', finalwidth: true, hide: true },
            { name: 'loginname', align: 'center', width: 120, label: '@Html.CurLang("登录名")' },
            { name: 'passwd', align: 'center', width: 120, label: '@Html.CurLang("密码")', render: function (value, data) { return '*******'; } },

            { name: 'nickname', align: 'center', width: 100, label: '@Html.CurLang("昵称")' },
            { name: 'realname', align: 'center', width: 100, label: '@Html.CurLang("真实姓名")' },
     
            { name: 'gender', align: 'center', width: 100, label: '@Html.CurLang("性别")', type: 'select', items: [{ '0': '@Html.CurLang("男")' }, { '1': '@Html.CurLang("女")' }] },

            { name: 'birthday', align: 'center', width: 200, label: '@Html.CurLang("生日")', type: 'date', pattern: 'yyyy-MM-dd' },
            { name: 'email', align: 'center', width: 200, label: '@Html.CurLang("邮箱")' },

            { name: 'office_phone', align: 'center', width: 150, label: '@Html.CurLang("办公电话")' },
            { name: 'mobile_phone', align: 'center', width: 100, label: '@Html.CurLang("个人电话")' },
            { name: 'role', align: 'center', width: 120, label: '@Html.CurLang("角色")', type: 'select', items: getYongHLX() },

            { name: 'shiyyy', align: 'center', width: 120, label: '@Html.CurLang("使用语言")', type: 'select', items: getShiYYY() },

            { name: 'state', align: 'center', width: 120, label: '@Html.CurLang("状态")', type: 'select', items: getState() },

            { name: 'added', align: 'center', width: 120, label: '@Html.CurLang("添加时间")', type: 'date', pattern: 'yyyy-MM-dd HH:mm', add: false, edit: false },
            { name: 'lastmodified', align: 'center', width: 120, label: '@Html.CurLang("最后修改时间")', type: 'date', pattern: 'yyyy-MM-dd HH:mm', add: false, edit: false },
        ]
    });

                 function refreshGri() {
                        userGrid@(Request.QueryString["_"]).datagrid('filter', {});
                    //userGrid@(Request.QueryString["_"]).datagrid('filter', { "clearOldPostData": true });
                }
                function customtBtn() {

                    return $("<button type='button' class='btn-default btn' onclick='refreshGri()'>@Html.CurLang("清空查询")</button>");
                 }

                function saveCallBack($trs, datas) {
                    userGrid@(Request.QueryString["_"]).datagrid('refresh', false);
                }


                function getShiYYY() {
                    var arr = new Array();
                    arr.push({ 'en': 'English' });
                    arr.push({ 'zh': '简体中文' });
                    //arr.push({ 'jp': '日本語' });
                    //arr.push({ 'kor': '한국어' });
                    arr.push({ 'spa': 'Español' });
                    return arr;
                }

                function getYongHLX() {
                    var arr = new Array();
                    arr.push({ '0': '@Html.CurLang("超级用户")' });
                    arr.push({ '1': '@Html.CurLang("管理用户")' });
                    arr.push({ '2': '@Html.CurLang("代理用户")' });
                    arr.push({ '3': '@Html.CurLang("个人用户")' });
                    return arr;
                }

                function getState() {
                    var arr = new Array();
                    arr.push({ '0': '@Html.CurLang("启用")' });
                    arr.push({ '1': '@Html.CurLang("禁用")' });
                    return arr;
                }


</script>
